<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "https://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" lang="zh">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=11"/>
<meta name="generator" content="Doxygen 1.9.8"/>
<meta name="viewport" content="width=device-width, initial-scale=1"/>
<title>My Project: drogon::Session类 参考</title>
<link href="tabs.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript" src="dynsections.js"></script>
<link href="search/search.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="search/searchdata.js"></script>
<script type="text/javascript" src="search/search.js"></script>
<link href="doxygen.css" rel="stylesheet" type="text/css" />
</head>
<body>
<div id="top"><!-- do not remove this div, it is closed by doxygen! -->
<div id="titlearea">
<table cellspacing="0" cellpadding="0">
 <tbody>
 <tr id="projectrow">
  <td id="projectalign">
   <div id="projectname">My Project
   </div>
  </td>
 </tr>
 </tbody>
</table>
</div>
<!-- end header part -->
<!-- 制作者 Doxygen 1.9.8 -->
<script type="text/javascript">
/* @license magnet:?xt=urn:btih:d3d9a9a6595521f9666a5e94cc830dab83b65699&amp;dn=expat.txt MIT */
var searchBox = new SearchBox("searchBox", "search/",'.html');
/* @license-end */
</script>
<script type="text/javascript" src="menudata.js"></script>
<script type="text/javascript" src="menu.js"></script>
<script type="text/javascript">
/* @license magnet:?xt=urn:btih:d3d9a9a6595521f9666a5e94cc830dab83b65699&amp;dn=expat.txt MIT */
$(function() {
  initMenu('',true,false,'search.php','搜索');
  $(document).ready(function() { init_search(); });
});
/* @license-end */
</script>
<div id="main-nav"></div>
<!-- window showing the filter options -->
<div id="MSearchSelectWindow"
     onmouseover="return searchBox.OnSearchSelectShow()"
     onmouseout="return searchBox.OnSearchSelectHide()"
     onkeydown="return searchBox.OnSearchSelectKey(event)">
</div>

<!-- iframe showing the search results (closed by default) -->
<div id="MSearchResultsWindow">
<div id="MSearchResults">
<div class="SRPage">
<div id="SRIndex">
<div id="SRResults"></div>
<div class="SRStatus" id="Loading">载入中...</div>
<div class="SRStatus" id="Searching">搜索中...</div>
<div class="SRStatus" id="NoMatches">未找到</div>
</div>
</div>
</div>
</div>

<div id="nav-path" class="navpath">
  <ul>
<li class="navelem"><a class="el" href="namespacedrogon.html">drogon</a></li><li class="navelem"><a class="el" href="classdrogon_1_1Session.html">Session</a></li>  </ul>
</div>
</div><!-- top -->
<div class="header">
  <div class="summary">
<a href="#pub-types">Public 类型</a> &#124;
<a href="#pub-methods">Public 成员函数</a> &#124;
<a href="#friends">友元</a> &#124;
<a href="classdrogon_1_1Session-members.html">所有成员列表</a>  </div>
  <div class="headertitle"><div class="title">drogon::Session类 参考</div></div>
</div><!--header-->
<div class="contents">

<p>This class represents a session stored in the framework. One can get or set any type of data to a session object.  
 <a href="classdrogon_1_1Session.html#details">更多...</a></p>

<p><code>#include &lt;<a class="el" href="Session_8h_source.html">Session.h</a>&gt;</code></p>
<table class="memberdecls">
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a id="pub-types" name="pub-types"></a>
Public 类型</h2></td></tr>
<tr class="memitem:a3a0d595286bd764b2d1537776a20cb86" id="r_a3a0d595286bd764b2d1537776a20cb86"><td class="memItemLeft" align="right" valign="top">using&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classdrogon_1_1Session.html#a3a0d595286bd764b2d1537776a20cb86">SessionMap</a> = std::map&lt; std::string, std::any &gt;</td></tr>
<tr class="separator:a3a0d595286bd764b2d1537776a20cb86"><td class="memSeparator" colspan="2">&#160;</td></tr>
</table><table class="memberdecls">
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a id="pub-methods" name="pub-methods"></a>
Public 成员函数</h2></td></tr>
<tr class="memitem:a9c0f4cf3ae90dcf3ab056ac31521eae3" id="r_a9c0f4cf3ae90dcf3ab056ac31521eae3"><td class="memTemplParams" colspan="2">template&lt;typename T &gt; </td></tr>
<tr class="memitem:a9c0f4cf3ae90dcf3ab056ac31521eae3"><td class="memTemplItemLeft" align="right" valign="top">T&#160;</td><td class="memTemplItemRight" valign="bottom"><a class="el" href="classdrogon_1_1Session.html#a9c0f4cf3ae90dcf3ab056ac31521eae3">get</a> (const std::string &amp;key) const</td></tr>
<tr class="memdesc:a9c0f4cf3ae90dcf3ab056ac31521eae3"><td class="mdescLeft">&#160;</td><td class="mdescRight">Get the data identified by the key parameter.  <br /></td></tr>
<tr class="separator:a9c0f4cf3ae90dcf3ab056ac31521eae3"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a438151436be4e02e1a38c4afc413482a" id="r_a438151436be4e02e1a38c4afc413482a"><td class="memTemplParams" colspan="2">template&lt;typename T &gt; </td></tr>
<tr class="memitem:a438151436be4e02e1a38c4afc413482a"><td class="memTemplItemLeft" align="right" valign="top">std::optional&lt; T &gt;&#160;</td><td class="memTemplItemRight" valign="bottom"><a class="el" href="classdrogon_1_1Session.html#a438151436be4e02e1a38c4afc413482a">getOptional</a> (const std::string &amp;key) const</td></tr>
<tr class="memdesc:a438151436be4e02e1a38c4afc413482a"><td class="mdescLeft">&#160;</td><td class="mdescRight">Get the data identified by the key parameter and return an optional object that wraps the data.  <br /></td></tr>
<tr class="separator:a438151436be4e02e1a38c4afc413482a"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a4799c04fbeb434828d81f8e66886b187" id="r_a4799c04fbeb434828d81f8e66886b187"><td class="memTemplParams" colspan="2">template&lt;typename T , typename Callable &gt; </td></tr>
<tr class="memitem:a4799c04fbeb434828d81f8e66886b187"><td class="memTemplItemLeft" align="right" valign="top">void&#160;</td><td class="memTemplItemRight" valign="bottom"><a class="el" href="classdrogon_1_1Session.html#a4799c04fbeb434828d81f8e66886b187">modify</a> (const std::string &amp;key, Callable &amp;&amp;handler)</td></tr>
<tr class="memdesc:a4799c04fbeb434828d81f8e66886b187"><td class="mdescLeft">&#160;</td><td class="mdescRight">Modify or visit the data identified by the key parameter.  <br /></td></tr>
<tr class="separator:a4799c04fbeb434828d81f8e66886b187"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:af586a180925de1ec0af28ec7ce029e8b" id="r_af586a180925de1ec0af28ec7ce029e8b"><td class="memTemplParams" colspan="2">template&lt;typename Callable &gt; </td></tr>
<tr class="memitem:af586a180925de1ec0af28ec7ce029e8b"><td class="memTemplItemLeft" align="right" valign="top">void&#160;</td><td class="memTemplItemRight" valign="bottom"><a class="el" href="classdrogon_1_1Session.html#af586a180925de1ec0af28ec7ce029e8b">modify</a> (Callable &amp;&amp;handler)</td></tr>
<tr class="memdesc:af586a180925de1ec0af28ec7ce029e8b"><td class="mdescLeft">&#160;</td><td class="mdescRight">Modify or visit the session data.  <br /></td></tr>
<tr class="separator:af586a180925de1ec0af28ec7ce029e8b"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a7b1db4bd0e469dc5962214ac51526966" id="r_a7b1db4bd0e469dc5962214ac51526966"><td class="memItemLeft" align="right" valign="top">void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classdrogon_1_1Session.html#a7b1db4bd0e469dc5962214ac51526966">insert</a> (const std::string &amp;key, const std::any &amp;obj)</td></tr>
<tr class="memdesc:a7b1db4bd0e469dc5962214ac51526966"><td class="mdescLeft">&#160;</td><td class="mdescRight">Insert a key-value pair  <br /></td></tr>
<tr class="separator:a7b1db4bd0e469dc5962214ac51526966"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:ab4326b1894f420e2553b08af43644649" id="r_ab4326b1894f420e2553b08af43644649"><td class="memItemLeft" align="right" valign="top">void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classdrogon_1_1Session.html#ab4326b1894f420e2553b08af43644649">insert</a> (const std::string &amp;key, std::any &amp;&amp;obj)</td></tr>
<tr class="memdesc:ab4326b1894f420e2553b08af43644649"><td class="mdescLeft">&#160;</td><td class="mdescRight">Insert a key-value pair  <br /></td></tr>
<tr class="separator:ab4326b1894f420e2553b08af43644649"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:afb8428bfc7f7e8f72ba8b12ea799e700" id="r_afb8428bfc7f7e8f72ba8b12ea799e700"><td class="memItemLeft" align="right" valign="top">void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classdrogon_1_1Session.html#afb8428bfc7f7e8f72ba8b12ea799e700">erase</a> (const std::string &amp;key)</td></tr>
<tr class="memdesc:afb8428bfc7f7e8f72ba8b12ea799e700"><td class="mdescLeft">&#160;</td><td class="mdescRight">Erase the data identified by the given key.  <br /></td></tr>
<tr class="separator:afb8428bfc7f7e8f72ba8b12ea799e700"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:add7381f0cd360e9c17a90cf08f04fbab" id="r_add7381f0cd360e9c17a90cf08f04fbab"><td class="memItemLeft" align="right" valign="top">bool&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classdrogon_1_1Session.html#add7381f0cd360e9c17a90cf08f04fbab">find</a> (const std::string &amp;key)</td></tr>
<tr class="memdesc:add7381f0cd360e9c17a90cf08f04fbab"><td class="mdescLeft">&#160;</td><td class="mdescRight">Return true if the data identified by the key exists.  <br /></td></tr>
<tr class="separator:add7381f0cd360e9c17a90cf08f04fbab"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a0568aea6589ac3acffc248eb9c2dcddc" id="r_a0568aea6589ac3acffc248eb9c2dcddc"><td class="memItemLeft" align="right" valign="top">void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classdrogon_1_1Session.html#a0568aea6589ac3acffc248eb9c2dcddc">clear</a> ()</td></tr>
<tr class="memdesc:a0568aea6589ac3acffc248eb9c2dcddc"><td class="mdescLeft">&#160;</td><td class="mdescRight">Clear all data in the session.  <br /></td></tr>
<tr class="separator:a0568aea6589ac3acffc248eb9c2dcddc"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a5cc88d9ac3f6fdd497609f5f3d587bdc" id="r_a5cc88d9ac3f6fdd497609f5f3d587bdc"><td class="memItemLeft" align="right" valign="top">std::string&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classdrogon_1_1Session.html#a5cc88d9ac3f6fdd497609f5f3d587bdc">sessionId</a> () const</td></tr>
<tr class="memdesc:a5cc88d9ac3f6fdd497609f5f3d587bdc"><td class="mdescLeft">&#160;</td><td class="mdescRight">Get the session ID of the current session.  <br /></td></tr>
<tr class="separator:a5cc88d9ac3f6fdd497609f5f3d587bdc"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a96e4bd48684d080b5b39371517f5f0c1" id="r_a96e4bd48684d080b5b39371517f5f0c1"><td class="memItemLeft" align="right" valign="top">void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classdrogon_1_1Session.html#a96e4bd48684d080b5b39371517f5f0c1">changeSessionIdToClient</a> ()</td></tr>
<tr class="memdesc:a96e4bd48684d080b5b39371517f5f0c1"><td class="mdescLeft">&#160;</td><td class="mdescRight">Let the framework create a new session ID for this session and set it to the client.  <br /></td></tr>
<tr class="separator:a96e4bd48684d080b5b39371517f5f0c1"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:ae6c5ce8ba0cb1db8cb9f4a6b8947b80a" id="r_ae6c5ce8ba0cb1db8cb9f4a6b8947b80a"><td class="memItemLeft" align="right" valign="top">&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classdrogon_1_1Session.html#ae6c5ce8ba0cb1db8cb9f4a6b8947b80a">Session</a> ()=delete</td></tr>
<tr class="separator:ae6c5ce8ba0cb1db8cb9f4a6b8947b80a"><td class="memSeparator" colspan="2">&#160;</td></tr>
</table><table class="memberdecls">
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a id="friends" name="friends"></a>
友元</h2></td></tr>
<tr class="memitem:ac01f2e55f53ab751ca060dd59189c930" id="r_ac01f2e55f53ab751ca060dd59189c930"><td class="memItemLeft" align="right" valign="top">class&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classdrogon_1_1Session.html#ac01f2e55f53ab751ca060dd59189c930">SessionManager</a></td></tr>
<tr class="separator:ac01f2e55f53ab751ca060dd59189c930"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:ac6432db4350125a5623ccfe713085fd5" id="r_ac6432db4350125a5623ccfe713085fd5"><td class="memItemLeft" align="right" valign="top">class&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classdrogon_1_1Session.html#ac6432db4350125a5623ccfe713085fd5">HttpAppFrameworkImpl</a></td></tr>
<tr class="separator:ac6432db4350125a5623ccfe713085fd5"><td class="memSeparator" colspan="2">&#160;</td></tr>
</table>
<a name="details" id="details"></a><h2 class="groupheader">详细描述</h2>
<div class="textblock"><p>This class represents a session stored in the framework. One can get or set any type of data to a session object. </p>
</div><h2 class="groupheader">成员类型定义说明</h2>
<a id="a3a0d595286bd764b2d1537776a20cb86" name="a3a0d595286bd764b2d1537776a20cb86"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a3a0d595286bd764b2d1537776a20cb86">&#9670;&#160;</a></span>SessionMap</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">using <a class="el" href="classdrogon_1_1Session.html#a3a0d595286bd764b2d1537776a20cb86">drogon::Session::SessionMap</a> =  std::map&lt;std::string, std::any&gt;</td>
        </tr>
      </table>
</div><div class="memdoc">

</div>
</div>
<h2 class="groupheader">构造及析构函数说明</h2>
<a id="ae6c5ce8ba0cb1db8cb9f4a6b8947b80a" name="ae6c5ce8ba0cb1db8cb9f4a6b8947b80a"></a>
<h2 class="memtitle"><span class="permalink"><a href="#ae6c5ce8ba0cb1db8cb9f4a6b8947b80a">&#9670;&#160;</a></span>Session()</h2>

<div class="memitem">
<div class="memproto">
<table class="mlabels">
  <tr>
  <td class="mlabels-left">
      <table class="memname">
        <tr>
          <td class="memname">drogon::Session::Session </td>
          <td>(</td>
          <td class="paramname"></td><td>)</td>
          <td></td>
        </tr>
      </table>
  </td>
  <td class="mlabels-right">
<span class="mlabels"><span class="mlabel">delete</span></span>  </td>
  </tr>
</table>
</div><div class="memdoc">

</div>
</div>
<h2 class="groupheader">成员函数说明</h2>
<a id="a96e4bd48684d080b5b39371517f5f0c1" name="a96e4bd48684d080b5b39371517f5f0c1"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a96e4bd48684d080b5b39371517f5f0c1">&#9670;&#160;</a></span>changeSessionIdToClient()</h2>

<div class="memitem">
<div class="memproto">
<table class="mlabels">
  <tr>
  <td class="mlabels-left">
      <table class="memname">
        <tr>
          <td class="memname">void drogon::Session::changeSessionIdToClient </td>
          <td>(</td>
          <td class="paramname"></td><td>)</td>
          <td></td>
        </tr>
      </table>
  </td>
  <td class="mlabels-right">
<span class="mlabels"><span class="mlabel">inline</span></span>  </td>
  </tr>
</table>
</div><div class="memdoc">

<p>Let the framework create a new session ID for this session and set it to the client. </p>
<dl class="section note"><dt>注解</dt><dd>This method does not change the session ID now. </dd></dl>

</div>
</div>
<a id="a0568aea6589ac3acffc248eb9c2dcddc" name="a0568aea6589ac3acffc248eb9c2dcddc"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a0568aea6589ac3acffc248eb9c2dcddc">&#9670;&#160;</a></span>clear()</h2>

<div class="memitem">
<div class="memproto">
<table class="mlabels">
  <tr>
  <td class="mlabels-left">
      <table class="memname">
        <tr>
          <td class="memname">void drogon::Session::clear </td>
          <td>(</td>
          <td class="paramname"></td><td>)</td>
          <td></td>
        </tr>
      </table>
  </td>
  <td class="mlabels-right">
<span class="mlabels"><span class="mlabel">inline</span></span>  </td>
  </tr>
</table>
</div><div class="memdoc">

<p>Clear all data in the session. </p>

</div>
</div>
<a id="afb8428bfc7f7e8f72ba8b12ea799e700" name="afb8428bfc7f7e8f72ba8b12ea799e700"></a>
<h2 class="memtitle"><span class="permalink"><a href="#afb8428bfc7f7e8f72ba8b12ea799e700">&#9670;&#160;</a></span>erase()</h2>

<div class="memitem">
<div class="memproto">
<table class="mlabels">
  <tr>
  <td class="mlabels-left">
      <table class="memname">
        <tr>
          <td class="memname">void drogon::Session::erase </td>
          <td>(</td>
          <td class="paramtype">const std::string &amp;&#160;</td>
          <td class="paramname"><em>key</em></td><td>)</td>
          <td></td>
        </tr>
      </table>
  </td>
  <td class="mlabels-right">
<span class="mlabels"><span class="mlabel">inline</span></span>  </td>
  </tr>
</table>
</div><div class="memdoc">

<p>Erase the data identified by the given key. </p>

</div>
</div>
<a id="add7381f0cd360e9c17a90cf08f04fbab" name="add7381f0cd360e9c17a90cf08f04fbab"></a>
<h2 class="memtitle"><span class="permalink"><a href="#add7381f0cd360e9c17a90cf08f04fbab">&#9670;&#160;</a></span>find()</h2>

<div class="memitem">
<div class="memproto">
<table class="mlabels">
  <tr>
  <td class="mlabels-left">
      <table class="memname">
        <tr>
          <td class="memname">bool drogon::Session::find </td>
          <td>(</td>
          <td class="paramtype">const std::string &amp;&#160;</td>
          <td class="paramname"><em>key</em></td><td>)</td>
          <td></td>
        </tr>
      </table>
  </td>
  <td class="mlabels-right">
<span class="mlabels"><span class="mlabel">inline</span></span>  </td>
  </tr>
</table>
</div><div class="memdoc">

<p>Return true if the data identified by the key exists. </p>

</div>
</div>
<a id="a9c0f4cf3ae90dcf3ab056ac31521eae3" name="a9c0f4cf3ae90dcf3ab056ac31521eae3"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a9c0f4cf3ae90dcf3ab056ac31521eae3">&#9670;&#160;</a></span>get()</h2>

<div class="memitem">
<div class="memproto">
<div class="memtemplate">
template&lt;typename T &gt; </div>
<table class="mlabels">
  <tr>
  <td class="mlabels-left">
      <table class="memname">
        <tr>
          <td class="memname">T drogon::Session::get </td>
          <td>(</td>
          <td class="paramtype">const std::string &amp;&#160;</td>
          <td class="paramname"><em>key</em></td><td>)</td>
          <td> const</td>
        </tr>
      </table>
  </td>
  <td class="mlabels-right">
<span class="mlabels"><span class="mlabel">inline</span></span>  </td>
  </tr>
</table>
</div><div class="memdoc">

<p>Get the data identified by the key parameter. </p>
<dl class="section note"><dt>注解</dt><dd>if the data is not found, a default value is returned. For example: <div class="fragment"><div class="line"><span class="keyword">auto</span> userName = sessionPtr-&gt;get&lt;std::string&gt;(<span class="stringliteral">&quot;user name&quot;</span>);</div>
</div><!-- fragment --> </dd></dl>

</div>
</div>
<a id="a438151436be4e02e1a38c4afc413482a" name="a438151436be4e02e1a38c4afc413482a"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a438151436be4e02e1a38c4afc413482a">&#9670;&#160;</a></span>getOptional()</h2>

<div class="memitem">
<div class="memproto">
<div class="memtemplate">
template&lt;typename T &gt; </div>
<table class="mlabels">
  <tr>
  <td class="mlabels-left">
      <table class="memname">
        <tr>
          <td class="memname">std::optional&lt; T &gt; drogon::Session::getOptional </td>
          <td>(</td>
          <td class="paramtype">const std::string &amp;&#160;</td>
          <td class="paramname"><em>key</em></td><td>)</td>
          <td> const</td>
        </tr>
      </table>
  </td>
  <td class="mlabels-right">
<span class="mlabels"><span class="mlabel">inline</span></span>  </td>
  </tr>
</table>
</div><div class="memdoc">

<p>Get the data identified by the key parameter and return an optional object that wraps the data. </p>
<dl class="tparams"><dt>模板参数</dt><dd>
  <table class="tparams">
    <tr><td class="paramname">T</td><td></td></tr>
  </table>
  </dd>
</dl>
<dl class="params"><dt>参数</dt><dd>
  <table class="params">
    <tr><td class="paramname">key</td><td></td></tr>
  </table>
  </dd>
</dl>
<dl class="section return"><dt>返回</dt><dd>optional&lt;T&gt; </dd></dl>

</div>
</div>
<a id="a7b1db4bd0e469dc5962214ac51526966" name="a7b1db4bd0e469dc5962214ac51526966"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a7b1db4bd0e469dc5962214ac51526966">&#9670;&#160;</a></span>insert() <span class="overload">[1/2]</span></h2>

<div class="memitem">
<div class="memproto">
<table class="mlabels">
  <tr>
  <td class="mlabels-left">
      <table class="memname">
        <tr>
          <td class="memname">void drogon::Session::insert </td>
          <td>(</td>
          <td class="paramtype">const std::string &amp;&#160;</td>
          <td class="paramname"><em>key</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">const std::any &amp;&#160;</td>
          <td class="paramname"><em>obj</em>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table>
  </td>
  <td class="mlabels-right">
<span class="mlabels"><span class="mlabel">inline</span></span>  </td>
  </tr>
</table>
</div><div class="memdoc">

<p>Insert a key-value pair </p>
<dl class="section note"><dt>注解</dt><dd>here the any object can be created implicitly. for example <div class="fragment"><div class="line">sessionPtr-&gt;insert(<span class="stringliteral">&quot;user name&quot;</span>, userNameString);</div>
</div><!-- fragment --> </dd>
<dd>
If the key already exists, the element is not inserted. </dd></dl>

</div>
</div>
<a id="ab4326b1894f420e2553b08af43644649" name="ab4326b1894f420e2553b08af43644649"></a>
<h2 class="memtitle"><span class="permalink"><a href="#ab4326b1894f420e2553b08af43644649">&#9670;&#160;</a></span>insert() <span class="overload">[2/2]</span></h2>

<div class="memitem">
<div class="memproto">
<table class="mlabels">
  <tr>
  <td class="mlabels-left">
      <table class="memname">
        <tr>
          <td class="memname">void drogon::Session::insert </td>
          <td>(</td>
          <td class="paramtype">const std::string &amp;&#160;</td>
          <td class="paramname"><em>key</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">std::any &amp;&amp;&#160;</td>
          <td class="paramname"><em>obj</em>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table>
  </td>
  <td class="mlabels-right">
<span class="mlabels"><span class="mlabel">inline</span></span>  </td>
  </tr>
</table>
</div><div class="memdoc">

<p>Insert a key-value pair </p>
<dl class="section note"><dt>注解</dt><dd>here the any object can be created implicitly. for example <div class="fragment"><div class="line">sessionPtr-&gt;insert(<span class="stringliteral">&quot;user name&quot;</span>, userNameString);</div>
</div><!-- fragment --> </dd>
<dd>
If the key already exists, the element is not inserted. </dd></dl>

</div>
</div>
<a id="af586a180925de1ec0af28ec7ce029e8b" name="af586a180925de1ec0af28ec7ce029e8b"></a>
<h2 class="memtitle"><span class="permalink"><a href="#af586a180925de1ec0af28ec7ce029e8b">&#9670;&#160;</a></span>modify() <span class="overload">[1/2]</span></h2>

<div class="memitem">
<div class="memproto">
<div class="memtemplate">
template&lt;typename Callable &gt; </div>
<table class="mlabels">
  <tr>
  <td class="mlabels-left">
      <table class="memname">
        <tr>
          <td class="memname">void drogon::Session::modify </td>
          <td>(</td>
          <td class="paramtype">Callable &amp;&amp;&#160;</td>
          <td class="paramname"><em>handler</em></td><td>)</td>
          <td></td>
        </tr>
      </table>
  </td>
  <td class="mlabels-right">
<span class="mlabels"><span class="mlabel">inline</span></span>  </td>
  </tr>
</table>
</div><div class="memdoc">

<p>Modify or visit the session data. </p>
<dl class="tparams"><dt>模板参数</dt><dd>
  <table class="tparams">
    <tr><td class="paramname">Callable</td><td>The signature of the callable should be equivalent to <code>void (<a class="el" href="classdrogon_1_1Session.html#a3a0d595286bd764b2d1537776a20cb86">Session::SessionMap</a> &amp;)</code> or <code>void (const <a class="el" href="classdrogon_1_1Session.html#a3a0d595286bd764b2d1537776a20cb86">Session::SessionMap</a> &amp;)</code> </td></tr>
  </table>
  </dd>
</dl>
<dl class="params"><dt>参数</dt><dd>
  <table class="params">
    <tr><td class="paramname">handler</td><td>A callable that can modify the sessionMap_ inside the session. </td></tr>
  </table>
  </dd>
</dl>
<dl class="section note"><dt>注解</dt><dd>This function is multiple-thread safe. </dd></dl>

</div>
</div>
<a id="a4799c04fbeb434828d81f8e66886b187" name="a4799c04fbeb434828d81f8e66886b187"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a4799c04fbeb434828d81f8e66886b187">&#9670;&#160;</a></span>modify() <span class="overload">[2/2]</span></h2>

<div class="memitem">
<div class="memproto">
<div class="memtemplate">
template&lt;typename T , typename Callable &gt; </div>
<table class="mlabels">
  <tr>
  <td class="mlabels-left">
      <table class="memname">
        <tr>
          <td class="memname">void drogon::Session::modify </td>
          <td>(</td>
          <td class="paramtype">const std::string &amp;&#160;</td>
          <td class="paramname"><em>key</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">Callable &amp;&amp;&#160;</td>
          <td class="paramname"><em>handler</em>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table>
  </td>
  <td class="mlabels-right">
<span class="mlabels"><span class="mlabel">inline</span></span>  </td>
  </tr>
</table>
</div><div class="memdoc">

<p>Modify or visit the data identified by the key parameter. </p>
<dl class="tparams"><dt>模板参数</dt><dd>
  <table class="tparams">
    <tr><td class="paramname">T</td><td>the type of the data. </td></tr>
  </table>
  </dd>
</dl>
<dl class="params"><dt>参数</dt><dd>
  <table class="params">
    <tr><td class="paramname">key</td><td></td></tr>
    <tr><td class="paramname">handler</td><td>A callable that can modify or visit the data. The signature of the handler should be equivalent to 'void(T&amp;)' or 'void(const T&amp;)'</td></tr>
  </table>
  </dd>
</dl>
<dl class="section note"><dt>注解</dt><dd>This function is multiple-thread safe. if the data identified by the key doesn't exist, a new one is created and passed to the handler. The changing of the data is protected by the mutex of the session. </dd></dl>

</div>
</div>
<a id="a5cc88d9ac3f6fdd497609f5f3d587bdc" name="a5cc88d9ac3f6fdd497609f5f3d587bdc"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a5cc88d9ac3f6fdd497609f5f3d587bdc">&#9670;&#160;</a></span>sessionId()</h2>

<div class="memitem">
<div class="memproto">
<table class="mlabels">
  <tr>
  <td class="mlabels-left">
      <table class="memname">
        <tr>
          <td class="memname">std::string drogon::Session::sessionId </td>
          <td>(</td>
          <td class="paramname"></td><td>)</td>
          <td> const</td>
        </tr>
      </table>
  </td>
  <td class="mlabels-right">
<span class="mlabels"><span class="mlabel">inline</span></span>  </td>
  </tr>
</table>
</div><div class="memdoc">

<p>Get the session ID of the current session. </p>

</div>
</div>
<h2 class="groupheader">友元及相关函数文档</h2>
<a id="ac6432db4350125a5623ccfe713085fd5" name="ac6432db4350125a5623ccfe713085fd5"></a>
<h2 class="memtitle"><span class="permalink"><a href="#ac6432db4350125a5623ccfe713085fd5">&#9670;&#160;</a></span>HttpAppFrameworkImpl</h2>

<div class="memitem">
<div class="memproto">
<table class="mlabels">
  <tr>
  <td class="mlabels-left">
      <table class="memname">
        <tr>
          <td class="memname">friend class HttpAppFrameworkImpl</td>
        </tr>
      </table>
  </td>
  <td class="mlabels-right">
<span class="mlabels"><span class="mlabel">friend</span></span>  </td>
  </tr>
</table>
</div><div class="memdoc">

</div>
</div>
<a id="ac01f2e55f53ab751ca060dd59189c930" name="ac01f2e55f53ab751ca060dd59189c930"></a>
<h2 class="memtitle"><span class="permalink"><a href="#ac01f2e55f53ab751ca060dd59189c930">&#9670;&#160;</a></span>SessionManager</h2>

<div class="memitem">
<div class="memproto">
<table class="mlabels">
  <tr>
  <td class="mlabels-left">
      <table class="memname">
        <tr>
          <td class="memname">friend class SessionManager</td>
        </tr>
      </table>
  </td>
  <td class="mlabels-right">
<span class="mlabels"><span class="mlabel">friend</span></span>  </td>
  </tr>
</table>
</div><div class="memdoc">

</div>
</div>
<hr/>该类的文档由以下文件生成:<ul>
<li><a class="el" href="Session_8h_source.html">Session.h</a></li>
</ul>
</div><!-- contents -->
<!-- start footer part -->
<hr class="footer"/><address class="footer"><small>
制作者&#160;<a href="https://www.doxygen.org/index.html"><img class="footer" src="doxygen.svg" width="104" height="31" alt="doxygen"/></a> 1.9.8
</small></address>
</body>
</html>
